package com.bm.server.dao;

import com.bm.server.dto.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description:
 * @Author: 赵金帅
 * @Date: 2022/07/18/23:59
 */
public interface UserSerachDao  {
    @Select("SELECT uh.headpath,u.nickName,u.account FROM t_userinfo AS u INNER JOIN t_user_head AS uh ON u.uid = uh.uid where u.nickName=#{name} ;")
    List<UserSearchDto> userSelectAllBy(@Param("name") String name);
    @Select("SELECT z.num,uh.headpath,u.nickName FROM t_user_head AS uh INNER JOIN t_userinfo AS u ON uh.uid = u.uid  INNER JOIN t_zuanshi AS z ON uh.uid = z.uid AND u.uid = z.uid WHERE uh.uid = #{uid}")
      List<UserZuanDto> userZuanSelect(int uid);
    @Select("(select uh.headpath,a.usernum ,rh.type ,rh.roomname,rh.roompath from t_user_head uh INNER JOIN t_rootinfo rt ON uh.uid=rt.uid INNER JOIN (SELECT count(*) as usernum,rid\n" +
            "FROM `t_rootinfo` GROUP BY rid) a on a.rid=rt.rid INNER JOIN t_room_head rh ON rh.roomid=a.rid )")
    List<ReMenDto>  selectReMen();
}
